<template>
	<view class="cantainer">
		<view class="whiteBox">
			<!-- <view class="bold mt10">温度</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywartemperature" class="uni-input" placeholder="请输入" /><span class="dw">℃</span></view>
			</view>

			<view class="line"></view>
			<view class="bold mt10">湿度</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarHumidity" class="uni-input" placeholder="请输入" /><span class="dw">%</span></view>
			</view>

			<view class="line"></view>
			<view class="bold mt10">空气颗粒度0.3</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle3" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度0.3</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle3" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度0.5</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle3" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度1.0</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle10" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度2.5</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle25" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度5.0</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle50" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>
			<view class="line"></view>
			<view class="bold mt10">空气颗粒度10.0</view>
			<view class="flexR between ptb10">
				<view>预警阀值</view>
				<view><input v-model="info.earlywarParticle100" class="uni-input" placeholder="请输入" /><span class="dw">μm</span></view>
			</view>

			<view class="line"></view> -->
			<view class="bold mt10">地点信息</view>
			<view>
				<textarea v-model="info.address" class="area" placeholder="请输入" rows="6" />
			</view>
		</view>
		<button class="btn" @click="save">保存</button>
		<view></view>

	</view>
</template>

<script>
export default {
	data() {
		return {
			info: {},
		};
	},
	onLoad(params) {
		let info = JSON.parse(params.info);
		info.address = info.address.trim();
		this.info = info;
	},
	methods: {
		save() {
			this.$axios({
				method: 'put',
				url: '/senor/device/updateAddress',
				data: {
					"id": this.info.id,
					"address": this.info.address,
					// "earlywartemperature": info.earlywartemperature,
					// "earlywarHumidity": info.earlywarHumidity,
					// "earlywarParticle3": info.earlywarParticle3,
					// "earlywarParticle5": info.earlywarParticle5,
					// "earlywarParticle10": info.earlywarParticle10,
					// "earlywarParticle100": info.earlywarParticle100,
					// "earlywarParticle25": info.earlywarParticle25,
					// "earlywarParticle50": info.earlywarParticle50
				},
			}).then(res=>{
				this.$msg('操作成功')
				uni.navigateBack({delta: 1});
			})
		}

	}
}
</script>

<style lang="scss" scoped>
.btn {
	margin-bottom: 10px;
	width: 80%px;
	height: 40px;
	position: sticky;
	bottom: 10px;
	line-height: 40px;
	border-radius: 20px;
	background-color: rgba(17, 168, 163, 1);
	color: rgba(255, 255, 255, 1);
	font-size: 16px;
	text-align: center;
}

.uni-input {
	display: inline-block;
	text-align: right;
}

.area {
	margin-top: 10px;
	border: 1px solid #f8f8f8;
	border-radius: 6px;
	padding: 10px;
	height: 100px;
	width: 100%;
}

.dw {
	display: inline-block;
	width: 2rem;
	text-align: right;
}
</style>
